﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace Managistics.Model.Mappings
{
    public class PurchaseOrderDetailMap : ClassMap<PurchaseOrderDetail>
    {

        public PurchaseOrderDetailMap()
        {
            Schema(Constants._tblSchema);
            Table(Constants._tblDetailOrderSupplier);
            LazyLoad();

            CompositeId().KeyProperty(x => x.Orderid, "ORDERID_NN")
                         .KeyProperty(x => x.ItemId, "ITEM_ID");
            References(x => x.PurchaseOrder).Column("ORDERID_NN");
            References(x => x.Good).Column("ITEM_ID");

            Map(x => x.Quantity).Column("QUANTITY_NN").Not.Nullable().Precision(53);
            Map(x => x.Discount).Column("DISCOUNT_NN").Precision(53);
            Map(x => x.UnitPrice).Column("UNIT_PRICE_NN").Not.Nullable().Precision(53);
            Map(x => x.StatusItem).Column("STATUS_ITEM_FD");
            Map(x => x.Vat).Column("VAT").Not.Nullable().Precision(5);
            Map(x => x.Id).Column("Id").Not.Nullable().Precision(18);
        }
    }
}
